from flask import *
app = Flask(__name__)
# user = Blueprint(name="goods",import_name=__name__,url_prefix="/user")
user = Blueprint("goods",__name__,url_prefix="/user")

@user.route("/")
def index():
    return {"code":0, "msg": "get success", "data": []}

@user.route("/login", methods=["POST"])
def login():
    return {"code": 1, "msg": "login success"}

@user.route("/html")
def html():
    people = [
        {
            "name": "lily",
            "age": 18,
            "gender": "female"
        },
        {
            "name": "tom",
            "age": 19,
            "gender": "male"
        },
    ]
    return render_template("hogwarts.html", people=people)

@user.route("/extend")
def extend():
    return render_template("son.html")

@user.route("/login1")
def login1():
    return url_for("goods.index")

@user.route("/login2")
def login2():
    print("登录，成功后跳转到首页")
    return redirect(url_for("goods.index"))

@user.route("/static")
def show_static():
    return render_template("static.html")






if __name__ == "__main__":
    app.register_blueprint(user)
    app.run()